<?php
/**
 *
 * @author crystal
 * @version 
 */
require_once 'Zend/View/Interface.php';

/**
 * BlockNews helper
 *
 * @uses viewHelper Zend_View_Helper
 */
class Zend_View_Helper_HandlySpecElement {
	
	/**
	 * @var Zend_View_Interface 
	 */
	public $view;
	
	/**
	 * 
	 */
	public function handlySpecElement($handlySpec, $role = null) {
        $reg = Zend_Registry::getInstance();
		$res = "";
        
        $res .= "<tr>";
            $res .= "<td colspan='3'>";
                if ($handlySpec['name'] != null){
        			$res .= $handlySpec['name'];
        		} else {
      		        $res .= "No name !";
        		}
            $res .= "</td>";
            $res .= "<td>";
                $res .= "Управління";
            $res .= "</td>";
        $res .= "</tr>";
        
		$res .= "<tr>";
            $res .= "<td rowspan='5'>";
                $res .= "<a class='single_image' href='" . $this->view->baseUrl(Application_Model_PathsService::getInstance()->get("handly_spec", false, array('web' => true))) . $handlySpec['file_name'] . "'>";            
                    $res .= "<div class='picture'>";
                        $res .= "<img src='" . $this->view->baseUrl(Application_Model_IconService::getInstance()->getIconPath("handly_spec", $handlySpec['file_name'], array('y' =>150))) . " '/>";
                    $res .= "</div>";
                $res .= "</a>"; 
            $res .= "</td>";
            
            $res .= "<td>";
                $res .= "Характеристики :";
            $res .= "</td>";
            $res .= "<td>";
                $res .= "Розміри (мм)";
            $res .= "</td>";
            $res .= "<td rowspan='5'>";
                $res .= "<div class='button'><a href='" .
    						$this->view->url( array('controller' => 'materials', 'action' => 'delhandlyspec', 'id' => $handlySpec['id'])) .
    						"'>Видалити</a></div>";
                $res .= "<div class='button'><a href='" .
    						$this->view->url( array('controller' => 'materials', 'action' => 'edithandlyspec', 'id' => $handlySpec['id'])) .
    						"'>Редагувати</a></div>";
            $res .= "</td>";
        $res .= "</tr>";
        
        $res .= "<tr>";
            $res .= "<td>";
                    $res .= "Ширина основи :";
                $res .= "</td>";
                $res .= "<td>";
                    $res .= $handlySpec['base_width'];
            $res .= "</td>";
        $res .= "</tr>";
        
        $res .= "<tr>";
            $res .= "<td>";
                $res .= "Ширина ручки :";
            $res .= "</td>";
            $res .= "<td>";
                $res .= $handlySpec['handle_width'];
            $res .= "</td>";
        $res .= "</tr>";
        
        $res .= "<tr>";
            $res .= "<td>";
                $res .= "Ширина захвата :";
            $res .= "</td>";
            $res .= "<td>";
                $res .= $handlySpec['capture'];
            $res .= "</td>";
        $res .= "</tr>";
        
        $res .= "<tr>";
            $res .= "<td>";
            $res .= "</td>";
            $res .= "<td>";
            $res .= "</td>";
        $res .= "</tr>";
        
		return $res;
	}
	
	/**
	 * Sets the view field 
	 * @param $view Zend_View_Interface
	 */
	public function setView(Zend_View_Interface $view) {
		$this->view = $view;
	}
}

